Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(visual-editing): add svelte optimistic state support #2307

Merged
merged 6 commits into from
Dec 19, 2024

Conversation

rdunk
Copy link
Member

@rdunk rdunk commented Dec 10, 2024

This PR adds optimistic state support for Svelte via the useOptimistic export in @sanity/visual-editing/svelte.

I've also re-worked a lot of the existing optimistic related exports, and added a new @sanity/visual-editing/optimistic export path which exposes the non-framework specific parts needed for e.g. Nuxt to implement this functionality.

Going forward we should recommend that the React version of useOptimistic be imported from @sanity/visual-editing/react rather than the root @sanity/visual-editing export path. I've added that export to the React specific path but haven't removed anything from that root path for now, so no breaking changes. I'm not sure how we can mark the root exports specifically as deprecated with TSDoc, open to ideas there!

So the two big things to review are:

  1. Do the changes to exports make sense?
  2. Does the Svelte useOptimistic implementation follow the existing React logic OK?

@rdunk rdunk requested a review from a team as a code owner December 10, 2024 17:58
Copy link

vercel bot commented Dec 10, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
live-visual-editing-next ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 19, 2024 11:06am
visual-editing-astro ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 19, 2024 11:06am
visual-editing-next ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 19, 2024 11:06am
visual-editing-next-with-i18n ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 19, 2024 11:06am
visual-editing-nuxt ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 19, 2024 11:06am
visual-editing-page-builder-demo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 19, 2024 11:06am
visual-editing-remix ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 19, 2024 11:06am
visual-editing-storybook ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 19, 2024 11:06am
visual-editing-svelte ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 19, 2024 11:06am
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
visual-editing-studio ⬜️ Skipped (Inspect) Dec 19, 2024 11:06am

Copy link
Member

@stipsan stipsan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've refactored the deprecation markings to follow the same approach we use for marking:

import createClient from '@sanity/client' // tsdoc says you should migrate to `import {createClient} from '@sanity/client'`

in @sanity/client.

Do the changes to exports make sense?

Yep!

Does the Svelte useOptimistic implementation follow the existing React logic OK?

And yep! Let's go!

@stipsan stipsan merged commit 73c7247 into main Dec 19, 2024
20 checks passed
@stipsan stipsan deleted the feat/optimistic-svelte branch December 19, 2024 11:08
@ecospark ecospark bot mentioned this pull request Dec 19, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants